<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/css/base2.css">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/css/style2.css">
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-2.1.4.min.js"></script>
		<title>红包管理-红包列表</title>
	</head>
	<body>
		<div class="page">
			<div class="main_menu fl">
		<c:forEach items="${sessionScope.MENU_LIST}" var="mainMenu">
			<c:if test="${mainMenu.wOOpid == 21}">
				<div class="menu_name">
					<a href="${pageContext.request.contextPath}/${mainMenu.wOAction}"
						target="main"> <img
						src="${pageContext.request.contextPath}${mainMenu.wOIcon}">
						<p>${mainMenu.wOName}</p>
					</a>
				</div>
			</c:if>
		</c:forEach>
		</div>
				<div class="main_cont fl">
					
					<div class="main_cont_top">
						<div class="main_inner clearfix">
							<div class="cont_top_time fr pr">
								
							</div>
						</div>
					</div>
					<div class="main_cont_bottom_moneyFafang">
						<div class="main_inner">
							
							<table>
							    <tr>
							    	<th><input type="checkbox" class="checked"></th>
							        <th>红包编号</th> 
							        <th>红包标题</th> 
							        <th>发行日期</th>
							        <th>有效天数</th>
							        <th>红包数量</th> 
							        <th>红包类型</th> 
							        <th>价值</th>
							        <th>使用规则</th>
							        <th>状态</th>
							        <th>操作</th>
							    </tr> 
							     <c:forEach items="${PAGE_BEAN.dataList}" var="coupon">
							    <tr> 
							        <td><input type="checkbox" class="checked"></td> 
							        <td>${coupon.id}</td> 
							        <td>${coupon.wCTitle}</td>
							        <td><fmt:formatDate
										value="${coupon.wCBeginTime }"
										pattern="yyyy-MM-dd HH:mm:ss" /></td> 
							        <td>${coupon.wCDays}天</td> 
							        <td>${coupon.wCPublishiCount}个</td>
							        <td>${coupon.wCType}红包</td> 
							        <td>${coupon.wCMoney}元</td>
							        <td>${coupon.wCDesc}</td>
							        <td><c:if test="${coupon.status == 0}">停用</c:if> 
										<c:if test="${coupon.status == 1}">启用</c:if> </td>
							        <td><c:if test="${coupon.status eq 0}">
									 <a onclick="qiyong(${coupon.id })">启用</a>
									</c:if>
									<c:if test="${coupon.status eq 1}">
									 <a href="javascript:void()" onclick="tingyong(${coupon.id })">停用</a>
									</c:if>
							        </i><i>
							        <a href="${pageContext.request.contextPath}/coupon/detail/${coupon.id}.html">编辑</a>
							        </i></td>
							    </tr> 
							    </c:forEach>
							</table> 
							<%@ include file="/WEB-INF/views/page.jsp"%>
						</div>
					</div>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
	function qiyong(id){
		 if(id!=""){
			 $.ajax({
				 	url:"/coupon/start/"+id+".json",
					success: function(data){
						alert(data.info);
					}
				});
		 }
	}
	
	function tingyong(id){
		 if(id!=""){
			 $.ajax({
				 	url:"/coupon/stop/"+id+".json",
					success: function(data){
						alert(data.info);
					}
				});
		 }
	}
	</script>
</html>
